package com.study.spmongodb.study.spring;

import com.study.spmongodb.study.spring.domain.User;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

import java.io.IOException;

/**
 * @author MI
 * @version 1.0
 * @date 2020/11/12 14:39
 */
public class Main {
    public static void main(String[] args) {
        ApplicationContext ctx = new ClassPathXmlApplicationContext("bean_1.xml");
        User sayHello = (User) ctx.getBean("sayHello");
        sayHello.addUser();
        System.out.println(sayHello.getName());

        Resource classPathResource = new ClassPathResource("bean_1.xml");
        try {
            System.out.println(classPathResource.getFile());
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
